<template>
	<view>
		<global-contact></global-contact>
		<view class="wrap">
			<u--textarea v-model="value" height="260" maxlength="600" placeholder="请输入内容" ></u--textarea> 
		</view>
		<view class="btn" @click="feedbackClick">
			提交
		</view>
	</view>
</template>

<script>
	import {feedback} from '@/utils/request.js'
	export default {
		data() {
			return {
				userInfo:JSON.parse(uni.getStorageSync('userInfo')||{}),
				value:'',
				isOk:true
			}
		},
		methods: {
			async feedback(data){
				return await feedback(data)
			},
			feedbackClick(){
				if(!this.value.trim()){
					uni.showToast({
						title:'请填写内容',
						icon:'none'
					})
					return;
				}
				if(!this.isOk)return;
				this.isOk=false
				let data={
					token:this.userInfo.token,
					contents:this.value
				}
				this.feedback(data).then(res=>{
					uni.showToast({
						title:'修改完成',
						duration:1500
					})
					setTimeout(()=>{
						uni.navigateBack({
							delta:1
						})
					},1500)
				})
			}
		}
	}
</script>

<style lang="scss">
	.wrap{
		padding: 30rpx;
	}
	.btn{
		width: 670rpx;
		line-height: 100rpx;
		border-radius: 25rpx;
		margin: 0 auto;
		background-color: #FFB850;
		color: #FFFFFF;
		text-align: center;
		position: fixed;
		bottom: 40rpx;
		left: 0;
		right: 0;
		margin: auto;
	}
</style>
